package com.authine.cloudpivot.ext.applicationservice;

import com.alibaba.cola.dto.SingleResponse;
import com.authine.cloudpivot.ext.dto.model.contract.ContractServiceFeeTemplate;
import com.authine.cloudpivot.ext.service.contract.ContractServiceFeeTemplateService;
import com.authine.cloudpivot.ext.service.contract.impl.ContractServiceFeeTemplateServiceImpl;
import com.authine.hermes.app.launcher.service.ApplicationService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;

import javax.ws.rs.POST;
import javax.ws.rs.Path;

import static com.authine.hermes.app.launcher.service.ApplicationServiceFoundation.CUSTOM_SERVICE;

@Path("ContractServiceFeeTemplateController")
@Slf4j
public class ContractServiceFeeTemplateController extends ApplicationService {
    static ContractServiceFeeTemplateService contractServiceFeeTemplateService = new ContractServiceFeeTemplateServiceImpl();

    @Path("updateContractServiceFeeTemplate")
    @POST
    @Operation(summary = "代购服务费模板管理-修改",description = "根据ID修改代购服务费模板，ID字段必传",tags = CUSTOM_SERVICE)
    public SingleResponse updateContractServiceFeeTemplate(ContractServiceFeeTemplate template){
        Assert.notNull(template,"参数不能为空");
        Assert.notNull(template.getId(), "要修改的代购服务费模板ID不能为空");
        contractServiceFeeTemplateService.update(template);
        return SingleResponse.buildSuccess();
    }
}
